package br.com.zynger.mst.addressbook;

/**
 * A person is anyone who
 * can belong to the
 * address book's list of
 * entries.
 * 
 * @author J. Zynger
 * @version 1.0 - November 2012
 */

public class Person {
	
	private String firstName; // The person's first name
	private String lastName; // The person's last name
	private String address; // The person's address
	private String city; // The person's home city
	private String state; // The person's home state
	private String phoneNumber; // The person's phone number
	private String zipCode; // The person's zip code
	
	public Person(String firstName, String lastName, String address,
			String city, String state, String phoneNumber, String zipCode) {
		//Refactoring 4: Remove Setting Method
		this.firstName = firstName;
		this.lastName = lastName;
		setAddress(address);
		setCity(city);
		setState(state);
		setPhoneNumber(phoneNumber);
		setZipCode(zipCode);
	}
	
	public String getFirstName() {
		return firstName;
	}
	
	public String getLastName() {
		return lastName;
	}
	
	public String getAddress() {
		return address;
	}
	
	public void setAddress(String address) {
		this.address = address;
	}
	
	public String getCity() {
		return city;
	}
	
	public void setCity(String city) {
		this.city = city;
	}
	
	public String getState() {
		return state;
	}
	
	public void setState(String state) {
		this.state = state;
	}
	
	public String getPhoneNumber() {
		return phoneNumber;
	}
	
	public void setPhoneNumber(String phoneNumber) {
		this.phoneNumber = phoneNumber;
	}
	
	public String getZipCode() {
		return zipCode;
	}
	
	public void setZipCode(String zipCode) {
		this.zipCode = zipCode;
	}
	
	/**
	 * Since in the address book, the entries are defined uniquely
	 * by their first and last names, check if this person has the same
	 * first and last name as the ones passed as parameters.
	 *
	 * @param firstName first name to compare
	 * @param lastName last name to compare
	 * @return true if both first and last names are equal to this person's
	 * first and last name, false otherwise.
	 */
	//Refactoring 2: Move Method (came from AddressBook.java)
	public boolean isSamePerson(String firstName, String lastName){
		if(getFirstName().equals(firstName) &&
				getLastName().equals(lastName)){
			return true;
		}else return false;
	}

	@Override
	public String toString() {
		return lastName + ", " + firstName + " -> "
				+ address + " " + city + " "
				+ state + " " + zipCode + " "
				+ phoneNumber;
	}
}
